<template>
  <div class="pho-form-item">
    <van-tabs class="pho-tabs" :type="defaultType" v-model="activeName" :style="newStyle">
      <van-tab v-for="item in list" :key="item.value" :title="item.label" :name="item.value">
        <span slot="title" :style="newStyle.font">{{item.label}}</span>
        <phone-form-row-container :list.sync="item.children" :font="newStyle.font" v-bind="$attrs" />
      </van-tab>
    </van-tabs>
  </div>
</template>
 
<script>
import { deepClone, toCamelCase } from "../../../utils/index";
import { comMixin } from "../../../utils/comMixins";
export default {
  mixins: [comMixin],
  name: "phone-form-tabs-container",
  props: {
    value: {
      type: [String, Number],
      default: "",
    },
    list: {
      type: Array,
      default: () => [],
    },
    type: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
      activeName: this.value || this.list[0].value,
      deepClone,
      toCamelCase,
    };
  },
  computed: {
    defaultType() {
      if (this.type == "card" || this.type == "border-card") return "card";
      return "line";
    },
  },
  watch: {
    value(newValue) {
      this.activeName = newValue;
    },
  },
};
</script>

<style lang="scss" >
@import "../../../styles/generator.scss";
.pho-tabs {
  .van-tabs__nav {
    background-color: transparent;
  }
  .van-tabs__content {
    height: calc(100% - 44px);
    overflow: auto;
  }
}
</style>